package com.vdong.shardingorder;

import cn.hutool.core.util.RandomUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.vdong.shardingorder.vo.order.req.SaveOrderReqVO;

public class A {
    public static void main(String[] args) {
        String str = "{\n" +
                "\t\"actualMoney\": 20000,\n" +
                "\t\"afterStatus\": 0,\n" +
                "\t\"couponMoney\": 0,\n" +
                "\t\"details\": [\n" +
                "\t\t{\n" +
                "\t\t\t\"goodsId\": 882329185092173824,\n" +
                "\t\t\t\"goodsName\": \"鞋子\",\n" +
                "\t\t\t\"img\": \"http://www.baidu.com/a.jpg\",\n" +
                "\t\t\t\"money\": 20000,\n" +
                "\t\t\t\"num\": 2,\n" +
                "\t\t\t\"price\": 10000\n" +
                "\t\t}\n" +
                "\t],\n" +
                "\t\"postageMoney\": 0,\n" +
                "\t\"status\": 1,\n" +
                "\t\"totalMoney\": 20000,\n" +
                "\t\"userId\": 12312321333\n" +
                "}";
        SaveOrderReqVO vo = JSONUtil.toBean(str, SaveOrderReqVO.class);

        for (int i = 0; i < 1000000000; i++) {
            long randomLong = RandomUtil.randomLong(10000000000L, 10000000100L);
            vo.setUserId(randomLong);
            String post = HttpUtil.post("http://127.0.0.1:18070/order/save", JSONUtil.toJsonStr(vo));
            System.out.println("post = " + post);
        }

    }
}
